"use strict";
const fs = require('fs');
const path = require('path');
let md = require('markdown-it')();
// let result = md.render("# markdown-it relezz!");
const watchPath = path.join(__dirname, 'README.md');
//1.监视文件
fs.watchFile(watchPath,{
    persistent: true
},() => {
    fs.readFile(watchPath,'utf8',(err, data) => {
        fs.writeFile(path.join(__dirname, 'markdown.html'),md.render(data),'utf8',(err) => {
            if(err) {
                console.log(err)
            }else {
                console.log('写入成功!!')
            }
        })
    })
});
